<%-- 
    Document   : manageUser
    Created on : Sep 18, 2013, 2:29:44 PM
    Author     : Tan Le Anh
--%>

<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<jsp:include page="header.jsp"/>
<script>
  function confirmDelete() {
    if (confirm("Bạn chắc chắn muốn xóa？")) {
      return true;
    } else {
      return false;
    }
  }
</script>
<div id="wrapper-page">
  <div class="function-wrap">
    <h2>Quản lý người dùng</h2>
    <a href="menuFunction.jsp" style="display:block;width:50px;" ><div class="btnbackMenu"></div></a>
    <div class="listProduct">
      <h3>Danh sách người dùng</h3>
      <div class="search">
        <form action="C_Users">
          <input style="padding-left:10px;width:200px; height:30px;" type="text" name="txtSearch" placeholder="Tên người dùng?"/>
          <input type="hidden" name="btAction" value="Search"/>
        </form>
      </div>
      <div class="list">
        <c:set var="info" value="${requestScope.INFO}"/>
        <c:if test="${not empty info}">
          <table style="width: 950px; border: 1px solid #dedede;">
            <tbody>
              <tr>
                <td>STT</td>
                <td>Tài khoản</td>
                <td>Tên người dùng</td> 
                <td>Giới tính</td>
                <td>Ngày sinh</td>
                <td>Chi tiết</td>
                <td>Thêm</td>
                <td>Sửa</td>
                <td>Xóa</td>
              </tr>
              <c:set var="count" value="0"/>
              <c:forEach var="rows" items="${info}">
                <c:set var="count" value="${count+1}"/>
                <tr>
                  <td>${count}</td>
                  <td>${rows.taikhoan}</td>
                  <td>${rows.tennguoidung}</td> 
                  <td>${rows.gioitinh}</td>
                  <td>${rows.ngaysinh}</td> 

                  <c:url var="details" value="C_Users">
                    <c:param name="btAction" value="Details"/>
                    <c:param name="username" value="${rows.taikhoan}"/>
                    <c:param name="txtSearch" value="${param.txtSearch}"/>
                  </c:url>
                  <td>
                    <a href="${details}">
                      <img src="./skin/images/details.png" width="20" style="float:left;"/>
                    </a>
                  </td>
                  <c:url var="details_insert" value="C_Users">
                    <c:param name="btAction" value="Details_Insert"/>
                  </c:url>
                  <td><a href="${details_insert}">
                      <img src="./skin/images/insert.png" width="20" style="float:left;"/>
                    </a></td>
                    <c:url var="details_update" value="C_Users">
                      <c:param name="btAction" value="Details_Update"/>
                      <c:param name="username" value="${rows.taikhoan}"/>
                    </c:url>
                  <td><a href="${details_update}">
                      <img src="./skin/images/update.png" width="20" style="float:left;"/>
                    </a></td>
                    <c:url var="delete" value="C_Users">
                      <c:param name="btAction" value="Delete"/>
                      <c:param name="username" value="${rows.taikhoan}"/>
                      <c:param name="txtSearch" value="${param.txtSearch}"/>
                    </c:url>
                  <td><a onclick="return confirmDelete()" href="${delete}">
                      <img src="./skin/images/deletered.png" width="20" style="float:left;"/>
                    </a>
                  </td>
                </tr>        
              </c:forEach>
            </tbody>
          </table>
        </c:if>
      </div>
    </div>  
    <c:set var="dt" value="${requestScope.DETAILS}"/>
    <c:if test="${not empty dt}">                  
      <div class="listProduct">
        <h3>Thông tin chi tiết</h3>
        <div style="margin: 0 auto;margin-bottom: 20px;">
          <table style="width: 950px; border: 1px solid #dedede;margin: 0 auto;" class="tables">
            <tbody>                  
              <tr>
                <td>Tài khoản:</td>
                <td>
                  <div class="input-control text">
                    <input disabled="disabled" class="inputLog" type="text" value="${dt.taikhoan}"/>
                  </div>
                </td>
                <td>Mật khẩu:</td>
                <td>
                  <div class="input-control password">
                    <input disabled="disabled" class="inputLog" type="password" value="${dt.matkhau}"/>
                  </div>
                </td>
              </tr>
              <tr>
                <td>Tên người dùng:</td>
                <td>
                  <div class="input-control text">
                    <input disabled="disabled" class="inputLog" type="text" value="${dt.tennguoidung}"/>
                  </div>
                </td>
                <td>Giới tính:</td>
                <td>
                  <div class="input-control text">
                    <input disabled="disabled" class="inputLog" type="text" value="${dt.gioitinh}"/>
                  </div>
                </td>

              </tr>
            <td>Ngày sinh:</td>
            <td>
              <div class="input-control text">
                <input disabled="disabled" class="inputLog" type="text" value="${dt.ngaysinh}"/>
              </div>
            </td>
            <td>Địa chỉ:</td>
            <td>
              <div class="input-control text">
                <input disabled="disabled" class="inputLog" type="text" value="${dt.diachi}"/>
              </div>
            </td>
            <tr>
              <td>Email:</td>
              <td>
                <div class="input-control text">
                  <input disabled="disabled" class="inputLog" type="text" value="${dt.email}"/>
                </div>
              </td>
              <td>Điện thoại:</td>
              <td>
                <div class="input-control text">
                  <input disabled="disabled" class="inputLog" type="text" value="${dt.dienthoai}"/>
                </div>
              </td>
            </tr>               
            <tr>
              <td>Số ATM:</td>
              <td>
                <div class="input-control text">
                  <input disabled="disabled" class="inputLog" type="text" value="${dt.soatm}"/>
                </div>
              </td>
              <td>Quyền:</td>
              <td>
                <div class="input-control text">
                  <input disabled="disabled" class="inputLog" type="text" 
                         <c:if test="${dt.loai==1}">
                           value="Customer Care"
                         </c:if>
                         <c:if test="${dt.loai==2}">
                           value="Merchandise"
                         </c:if>
                         <c:if test="${dt.loai==3}">
                           value="Accountant"
                         </c:if>
                         <c:if test="${dt.loai==4}">
                           value="System Administrator"
                         </c:if>
                         <c:if test="${dt.loai==5}">
                           value="Customer"
                         </c:if>/>
                </div>
              </td>
            </tr>           
            </tbody>
          </table>

        </div>
      </div>  
    </c:if>
  </div>      
</div>              
</body>
</html>
